{% set pypi_name = 'python-zunclient' %}
{% set upstream_version = upstream_version('4.1.1') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Client Library for OpenStack Containers service
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('ddt') }}
BuildRequires:  {{ py3('docker') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('python-openstackclient') }}
BuildRequires:  {{ py3('osc-lib') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testresources') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildRequires:  {{ py3('websocket-client') }}
BuildArch:      noarch

%description
Client library and command line utility for interacting with Openstack
Containers API.

%package -n python3-zunclient
Summary:        Client Library for OpenStack Containers service
Requires:       {{ py3('PrettyTable') }}
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('docker') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('python-openstackclient') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('websocket-client') }}

%description -n python3-zunclient
Client library and command line utility for interacting with Openstack
Containers API.

%package -n python-zunclient-doc
Summary:        Documentation for OpenStack Containers API Client
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n python-zunclient-doc
Client library and command line utility for interacting with Openstack
Containers API.
This package contains auto-generated documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}


%install
%{py3_install}
# bash completion
install -p -D -m 644 tools/zun.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/zun.bash_completion

%check
export OS_TEST_PATH=./zunclient/tests/unit/
# we don't want to depend on Tempest so remove the relevant tests
rm -f zunclient/tests/unit/test_shell.py
rm -f zunclient/tests/unit/test_functional_utils.py
rm -rf zunclient/tests/functional
python3 -m stestr.cli run

%files -n python3-zunclient
%doc README.rst
%license LICENSE
%{python3_sitelib}/zunclient
%{python3_sitelib}/*.egg-info
%{_bindir}/zun
%{_sysconfdir}/bash_completion.d/zun.bash_completion

%files -n python-zunclient-doc
%license LICENSE
%doc doc/build/html

%changelog
